import React, { useEffect, useState } from 'react'
import * as server from '../api/request'
import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom'
import RouterView from './routerView'
import routerConfig from './routerConfig'
import store from '../store/index'

import Home from '../view/home'
import Login from '../view/login'
import NotFound from '../view/notFound'
import MeetingRoom from '../view/meeting'

const RouterConfig: React.FC = () => {
    // const [count, setCount] = useState(0)
    // useEffect(() => {
    //     server.getDynamicDictionary({
    //         dictionaryCodes: 'dynamic_dictionaries_sex,dynamic_dictionaries_posts'
    //     }).then(res => {
    //         // console.log(res, 111)
    //     })
    //     // console.log(count, '改变前')
    //     // console.log(store.getState())
    //     const text = 1
    //     setCount(text)
    //     // console.log(count, '改变后')
    // })
    return (
        <BrowserRouter>
            <Switch>
                <Route path={ '/' } exact component={ Home } />
                <Route path={ '/meeting' } component={ Home }>
                </Route>
                <Route path={'/login'}>
                    <Login />
                </Route>
                <Route path={'*'}>
                    <NotFound />
                </Route>
            </Switch>
        </BrowserRouter>
    )
}

export default RouterConfig